/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelConceito.java
 *
 * Created on 30/09/2010, 02:01:04
 */

package aprendizadosemfio.Telas;

import aprendizadosemfio.entidades.TipoDeRede;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.SimpleAttributeSet;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;

/**
 *
 * @author Usuario
 */
public class PanelConceito extends javax.swing.JPanel {
    

    TipoDeRede tipoRede;
    /** Creates new form PanelConceito */
    public PanelConceito() {
        
        initComponents();
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        BotaoAntes = new javax.swing.JButton();
        BotaoDepois = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        AreaConceito = new javax.swing.JTextPane();

        setBackground(new java.awt.Color(255, 255, 255));

        BotaoAntes.setBackground(new java.awt.Color(255, 255, 255));
        BotaoAntes.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/back2.PNG"))); // NOI18N
        BotaoAntes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoAntesActionPerformed(evt);
            }
        });

        BotaoDepois.setBackground(new java.awt.Color(255, 255, 255));
        BotaoDepois.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/forward2.PNG"))); // NOI18N
        BotaoDepois.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotaoDepoisActionPerformed(evt);
            }
        });

        AreaConceito.setEditable(false);
        AreaConceito.setFont(new java.awt.Font("Tahoma", 0, 16));
        jScrollPane1.setViewportView(AreaConceito);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(279, Short.MAX_VALUE)
                .addComponent(BotaoAntes, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BotaoDepois, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11))
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 384, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 343, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(BotaoDepois, 0, 0, Short.MAX_VALUE)
                    .addComponent(BotaoAntes, javax.swing.GroupLayout.PREFERRED_SIZE, 40, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
    }// </editor-fold>//GEN-END:initComponents



    private void BotaoAntesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoAntesActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BotaoAntesActionPerformed

    private void BotaoDepoisActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoDepoisActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BotaoDepoisActionPerformed


    public void insereConceito() {

        AreaConceito.setText(tipoRede.getConceito());

        StyledDocument doc = this.AreaConceito.getStyledDocument();

        MutableAttributeSet standard = new SimpleAttributeSet();
        StyleConstants.setAlignment(standard, StyleConstants.ALIGN_JUSTIFIED); //atribui cor vermelha
        StyleConstants.setFontSize(standard,16);
        StyleConstants.setFontFamily(standard, "TIMES");
        doc.setParagraphAttributes(0, 0, standard, true);

        AreaConceito.setCaretPosition(0);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextPane AreaConceito;
    private javax.swing.JButton BotaoAntes;
    private javax.swing.JButton BotaoDepois;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables

    void setTipo(TipoDeRede tipo) {
       this.tipoRede=tipo;
    }

}
